package com.hopes.bizz.risk.transfer.bean.log.vo;

import com.hopes.bizz.common.core.util.StringUtils;
import lombok.Data;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author lyb
 * @version 1.0
 * @date 2024/2/20 18:02
 */

@Data
public class RiskLogVo {

    private String batchId;
    private String status;
    private RiskLogStatistics statistics;
    private List<String> errorIds;

    public void setErrorIdStr(String errorIdStr) {
        if (StringUtils.isBlank(errorIdStr)) {
            return;
        }
        this.errorIds = Arrays.stream(errorIdStr.split(",")).collect(Collectors.toList());
    }

    public void setTotalCount(int totalCount) {
        if (Objects.isNull(this.statistics)) {
            this.statistics = new RiskLogStatistics();
        }
        this.statistics.setTotalCount(totalCount);
    }

    public void setErrorCount(int errorCount) {
        if (Objects.isNull(this.statistics)) {
            this.statistics = new RiskLogStatistics();
        }
        this.statistics.setErrorCount(errorCount);
    }
}
